package com.example.jenkins.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JenkinsController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @RequestMapping(value = "/{test}",method = RequestMethod.GET)
    public String test(@PathVariable String test){
        ValueOperations<String, String> ops = redisTemplate.opsForValue();
        String tt = ops.get(test);
        if (tt==null){
            ops.set(test,test);
        }
        return ops.get(test);
    }
}
